#include "widget.h"
#include "ui_widget.h"
#include<QPushButton>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QPushButton* button=new QPushButton("关闭窗口",this);
    connect(button,&QPushButton::clicked,this,[=](){this->close();});//使用lamda表达式

}

Widget::~Widget()
{
    delete ui;
}
